]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
calendar: Emit selected-date-changed before rebuilding the calendar
authorSebastian Keller <skeller@gnome.org>
Sun, 22 Oct 2023 23:06:59 +0000 (01:06 +0200)
committerSebastian Keller <skeller@gnome.org>
Sun, 22 Oct 2023 23:29:12 +0000 (01:29 +0200)
If the cursor was placed on one of the widgets that get removed when
rebuilding the calendar due to a month change, destroying the hovered
widget will trigger a repick. This repick can then trigger an allocation
while not all buttons of the calendar are present.

If the last allocation before selected-date-changed is emitted was from
such an incomplete state, DateMenuButton will still freeze the layout in
this state in its signal handler.

What freezing the layout in DateMenuButton is supposed to do is to
prevent size changes of the menu when changing days, but for this the
layout needs to be frozen before potentially rebuilding calendar. This
change ensures that by emitting the signal earlier.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5411
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5469
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2989>

js/ui/calendar.js

index 1371abf3354cd5a3cace0895b76c562139d7f88a..6de034c2c262ae56771b068d5e9e6c4664d44b69 100644 (file)
@@ -471,11 +471,12 @@ export const Calendar = GObject.registerClass({
             return;
 
         this._selectedDate = date;
-        this._update();
 
         let datetime = GLib.DateTime.new_from_unix_local(
             this._selectedDate.getTime() / 1000);
         this.emit('selected-date-changed', datetime);
+
+        this._update();
     }
 
     updateTimeZone() {